package com.it.tydic.estate.module.controller.ckgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.model.inner.TbCkglRkckgl;
import com.it.tydic.estate.module.service.CkglService;
import com.it.tydic.estate.module.service.RkglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: 孟繁炫
 * @createDate: 2020/3/4
 * @version: 1.0
 */
@RestController
@RequestMapping("ckgl")
@Api(tags ="仓库管理-出库管理接口")
public class CkglController {
    /**
     * 注入接口
     */
    @Autowired
    private CkglService ckglService;

    /**
     *  保存出库管理信息
     */
    @PostMapping("/insert")
    @ControllerDesc(description = LogConstants.addOrUpdate_data)
    @ApiOperation(value = "新增出库管理信息", notes = "新增出库管理信息")
    public Result insert(@RequestBody TbCkglRkckgl rkckgl){
        return ckglService.insertOrUpdate(rkckgl);
    }

    /**
     * 根据主键查询
     */
    @GetMapping("/getById/{id}")
    @ApiOperation(value = "根据id查询用", notes = "查询数据库中的某个出库管理")
    public Result getById(@RequestParam String id){
        return ckglService.getById(id);
    }

    /**
     * 出库管理列表页面查询
     */
    @PostMapping("/pageList")
    @ApiOperation(value = "出库管理列表信息", notes = "出库管理列表信息")
    public Result pageList(@RequestBody Map<String,Object>map){
           return ckglService.pageList(map);
    }

    /**
     * 根据ids 批量删除
     * @param ids 主键ids数组
     * @return
     */
    @ApiOperation("批量逻辑删除")
    @ControllerDesc(description = LogConstants.delete_data)
    @PostMapping("/deleteByIds")
    public Result deleteByIds(@RequestBody List<String> ids) {
        return ckglService.deleteByIds(ids);
    }
}
